Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't rewrite floats and don't break e+ syntax #246

Merged
merged 2 commits into from
Sep 3, 2024
Merged

Conversation

infinisil
Copy link
Member

Fixes #244

  • Parses floats into their text as-is, without rewriting anything. This means that floats like 0.068 aren't rewritten as 6.8e-2 anymore. However, .0 is also not rewritten as 0.0 anymore.
  • Fixes a parsing bug that caused 1.e+0 to be formatted as 1.e + 0, which is invalid syntax

This work is sponsored by Antithesis

- Parses floats into their text as-is, without rewriting anything. This
  means that floats like `0.068` aren't rewritten as 6.8e-2 anymore.
  However, `.0` is also not rewritten as `0.0` anymore.
- Fixes a parsing bug that caused `1.e+0` to be formatted as `1.e + 0`,
  which is invalid syntax
Copy link

github-actions bot commented Aug 29, 2024

Nixpkgs diff

src/Nixfmt/Parser/Float.hs Outdated Show resolved Hide resolved
@infinisil infinisil merged commit 8a73acf into master Sep 3, 2024
2 checks passed
@infinisil infinisil deleted the fix-floats branch September 3, 2024 18:24
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2024-09-03/51584/1

@adrian-gierakowski
Copy link

Would be great if we could land this in nixpkgs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

rather simple decimal floats are converted to scientific / "E" notation
6 participants